#include<stdio.h>
#include<math.h>
int main()
{
	double l,t;
	double F=0,f=0,f_=0;
	scanf("%lf %lf",&l,&t); 
	if(l<=3)f=10;
	else if(l>3&&l<=10)f=10+(l-3)*2;
	else if(l>10)f=24+(l-10)*3;
	f_=floor(t/5)*2;
	F=f+f_;
	printf("%.0lf",F);
	return 0;
}
